using Godot;
using Godot.Collections;
using System;

//放置在根节点下的第一个，防止使用时未初始化
public partial class TimeController : Node
{
    public static TimeController Instance { get; private set; }

	public Dictionary<CharacterBody2D,float> timeScales;
    public override void _Ready()
    {        
        Instance = this;
		timeScales = new Dictionary<CharacterBody2D, float>();		
    }

    public void SetTimeScale(CharacterBody2D node,float scale)
    {			
		// if(timeScales.ContainsKey(node))
		// {
		// 	timeScales[node]=scale;
		// }
		// else
		// {
		// 	timeScales.Add(node,scale);
		// }
		timeScales[node]=scale;
    }
	public float GetTimeScale(CharacterBody2D node)
	{
		if(timeScales.ContainsKey(node))
			return timeScales[node];
		else 
			return 1;
	}
}